<%@page import="com.util.QQUtils"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Insert title here</title>
  <link href="bootstrap/css/bootstrap.css" rel="stylesheet"/>
  <link href="bootstrap/css/login.css" rel="stylesheet"/>
  <script type="text/javascript">
  function login() {
    var username = document.getElementById("username").value;
    if(username==""){
      alert("昵称不能为空");
      return
    }
    
    var password = document.getElementById("inputPassword").value;
    if(password==""){
      alert("密码不能为空");
      return
    }
    var password2 = document.getElementById("inputPassword2").value;
    if(password2==""){
      alert("确认密码不能为空");
      return
    }
    if(password2 != password){
        alert("2次密码不匹配");
        return
      }
    document.getElementById("fid").submit();
  }

  </script>
</head>
<body>
<div class="container">
<div align="center">
  <form class="form-signin" id="fid" action="action.jsp" method="post"> 
    <h2 class="form-signin-heading">WEChat注册</h2>
	 <div class="form-group has-success has-feedback">
	  <div class="input-group">
	    <span class="input-group-addon">QQ:</span>
	    <input type="text" class="form-control" name="qq" value="<%=QQUtils.genQQnum() %>" readonly="readonly" id="qq" aria-describedby="inputGroupSuccess1Status">
	  </div>
	  <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
	  <span id="inputGroupSuccess1Status" class="sr-only">(success)</span>
	  <span style="color: red;">请牢记QQ</span>
	</div>
	
    <label for="username" class="sr-only">昵称</label>
    <input type="text" id="username" name="username" class="form-control" placeholder="昵称" required>
    
    <label for="inputPassword" class="sr-only">密码</label>
    <input type="password" id="inputPassword" name="password" class="form-control" placeholder="密码" required>
    
    <label for="inputPassword" class="sr-only">确认密码</label>
    <input type="password" id="inputPassword2" name="password2" class="form-control" placeholder="确认密码" required>
    
     <label for="age" class="sr-only">年龄</label>
     <input type="text" id="age" name="age"  class="form-control" placeholder="年龄" required autofocus>
     
     <label for="sex" class="sr-only">性别</label>
     <input type="radio" name="sex" value="1" checked="checked"> 男<input type="radio" name="sex" value="0"> 女
    
    <button class="btn btn-lg btn-primary btn-block" type="button" onclick="login()">注册</button>
    <h2 class="form-signin-heading"><%=request.getAttribute("message")==null?"":request.getAttribute("message") %></h2>
  </form>
</div>
</div>
</body>
</body>
</html>